home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / utilities / easyproc2.lha / EasyProcess / launch / KillProcs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-05  |  1.0 KB  |  57 lines

  1. #include "Launch.h"
  2. #include "LaunchPriv.h"
  3.  
  4. /*
  5.  *    NAME
  6.  *        KillProcesses -- try to kill all child via a signal.
  7.  *
  8.  *    SYNOPSIS
  9.  *        KillProcesses ()
  10.  *
  11.  *        void KillProcesses (void);
  12.  *
  13.  *    DESCRIPTION
  14.  *        Send a KILL_PROCESS_FLAG signal to all child process of this
  15.  *        process.
  16.  *
  17.  *    INPUT
  18.  *        None.
  19.  *
  20.  *    OUTPUT
  21.  *        None.
  22.  *
  23.  *    NOTE
  24.  *        This only tries to kill your OWN child processes, not children
  25.  *        of your children.
  26.  *
  27.  *        This function does not wait to see if the processes really die,
  28.  *        you MUST call WaitProcesses() before quitting !!!
  29.  *
  30.  *    HISTORY
  31.  *        1992/09/06    Pierre Baillargeon        Creation
  32.  *
  33.  *    SEE ALSO
  34.  *        StartProcess(), WaitProcesses(), WaitProcess()
  35.  */
  36.  
  37. void KillProcesses (void)
  38. {
  39.     struct Process *Proc;
  40.     struct ProcPair *pp;
  41.  
  42.     Forbid ();
  43.     if (ProcPairList)
  44.     {
  45.         Proc = (struct Process *)FindTask (NULL);
  46.  
  47.         for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
  48.         {
  49.             if (Proc == pp->pp_Parent)
  50.             {
  51.                 Signal (pp->pp_Child, KILL_PROCESS_FLAG);
  52.             }
  53.         }
  54.     }
  55.     Permit ();
  56. }
  57.